﻿@inject IDataCacheService _dataCatcheService

<div class="rounded  shadow-sm bg-opacity mb-4">
    @((MarkupString)Model.MainPage)
</div>

@if (isReady)
{
    <CnGalWebSite.Shared.MasaComponent.PC.Comments.CommentTip CanComment CanDeleted="CanDeleted" ObjectId="2795" Type="CommentType.CommentArticle" Desc/>
}

@code {

    bool CanDeleted;
    bool isReady;
    [CascadingParameter]
    private Task<AuthenticationState> authenticationStateTask { get; set; }
    public ArticleViewModel Model { get; set; } = new ArticleViewModel();

    [CascadingParameter]
    public ErrorHandler ErrorHandler { get; set; }

    protected override async Task OnInitializedAsync()
    {
        try
        {
            var userState = await authenticationStateTask;
            var user = userState.User;
            if (user.IsInRole("Admin"))
            {
                CanDeleted = true;
            }
            Model = await _dataCatcheService.ArticleIndexPageCatche.GetCache("2795");
            isReady = true;
        }
        catch (Exception ex)
        {
            await ErrorHandler.ProcessError(ex, "获取获取周年庆主页失败");
        }

    }

}
